//
//  PerRealNameViewController.m
//  CYWFrame
//
//  Created by Macx on 2017/8/14.
//  Copyright © 2017年 Macx. All rights reserved.
//

#import "PerRealNameViewController.h"
#import "LCButton.h"
#import "RealNameContentViewController.h"

@interface PerRealNameViewController ()

@end

@implementation PerRealNameViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self buildUI];
    
}

#pragma mark ==========构建UI==========
- (void)buildUI {
    
    self.view.backgroundColor = kWhiteColor;
    
    self.navigationItem.title = @"实名认证";
    
    NSArray *imgArr = @[@"ordinary_identify", @"senior_identify"];
    NSArray *textArr = @[@"普通认证", @"专家认证"];
    for (int i = 0; i < imgArr.count; i++) {
        LCButton *indexBtn = [[LCButton alloc] initWithFrame:CGRectMake(0, 0, SW(2), SW(2))];
        if (i == 0) {
            indexBtn.center = CGPointMake(SW(2), SH(2)-SW(2));
        }
        else
            indexBtn.center = CGPointMake(SW(2), SH(2)+SW(10));
        [indexBtn setTitle:textArr[i] forState:UIControlStateNormal];
        [indexBtn setTitleColor:kGrayColor forState:UIControlStateNormal];
        [indexBtn setImage:IMAGE(imgArr[i]) forState:UIControlStateNormal];
        indexBtn.adjustsImageWhenHighlighted = NO;
        [self.view addSubview:indexBtn];
        indexBtn.titleLabel.backgroundColor = UIMainColorRGB;
        indexBtn.titleLabel.layer.cornerRadius = indexBtn.titleLabel.height/2;
        indexBtn.titleLabel.layer.masksToBounds = YES;
        [indexBtn setTitleColor:kWhiteColor forState:UIControlStateNormal];
        indexBtn.titleLabel.font = kUHSystemFontWithSize(16);
        [indexBtn addTarget:self action:@selector(wayClick:) forControlEvents:UIControlEventTouchUpInside];
//        [indexBtn.titleLabel addTarget:self action:@selector(wayClick:)];
    }

    
}

#pragma mark ==========响应方法==========
- (void)wayClick:(LCButton *)sender {
    RealNameContentViewController *realNameVC = [[RealNameContentViewController alloc] init];
    if ([sender.titleLabel.text isEqualToString:@"普通认证"]) {
        realNameVC.isExperts = 0;
    }
    else
        realNameVC.isExperts = 1;
    
    [self.navigationController pushViewController:realNameVC animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
